home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Linux Cubed Series 7: Sunsite
/
Linux Cubed Series 7 - Sunsite Vol 1.iso
/
system
/
admin
/
newinfo-.000
/
newinfo-
/
newinfo
< prev
next >
Wrap
Text File
|
1995-05-13
|
6KB
|
255 lines
#!/bin/bash
# Matt's Newinfo System Shell. 14/05/95.
#
# Matt's Newinfo System V1.1
#
# Copyright (C) Matt Bottrell, 1995. All rights reserved.
#
#-----------------------------------------------------------------------------
# IMPORTANT! :
# Edited areas are listed as %% text to edit %% Read the comment above to
# find out what the area is specifically for. In this state it creates a
# nice information system that allows the admin user to create update files
# per month. This can easily be edited to create a user login screen.
#
# The next version will include termcap support for ESC, Crtl-C, Crtl-Z etc,
# making the system more stable.
#
# Please note, the only restriction on the sytem is that the initial loading
# screen is left in-tact.
# ------------------------------------------------------------------------------
#
#
PATH=/bin:/usr/bin:/etc:/usr/5bin:/usr/ucb
# Setup pretty stuff
kl=`tput kcub1`
mb=`tput blink`
so=`tput smso`
md=`tput bold`
us=`tput smul`
dl=`tput dl`
me=`tput sgr0`
cl=`tput clear`
# Counter Input from user
tnum=0
DATE=`date| awk '{printf ("%s %s %s, %s ", $1, $3, $2, $6)}'`
TIME=`date +%H:%M`
PERSON=`whoami`
MACHINE=`sed -n '1p' /etc/HOSTNAME`
#
# Function definitions!
#
# Prompt for yes or no answer - returns non-zero for no
getyn() {
while echo "\n$* (y/n)$mb?$me \c">&2
do read yn rest
case $yn in
[yY]) return 0
;;
[nN]) return 1
;;
*) echo "Please answer y or n" >&2
;;
esac
done
}
# function to read in the requested file.
read_news() {
clear
echo $btype
echo " "
sleep 2
less -M -e $FILEREAD
}
# exit and clean up after yourself
bye_bye() {
rm -f /tmp/$$*
clear
echo "$me $md Exiting the %% Enter the menu system name here %%...."
echo " "
echo " Hope you enjoyed your stay, $PERSON!$me"
exit $*
}
# Prompt with mesg, return non-zero on q
prompt() {
clear
while clear;echo -n "${mesg}$so " >&2
do read cmd
case $cmd in
+x|-x) set $cmd ;;
Q|q) echo " "; return 1 ;;
# !*) eval `expr "$cmd" : "!\(.*\)"` ;;
"") # If there is an argument use it as the default
# else loop until 'cmd' is set
[ "$1" ] && {
cmd=$1
return 0
}
: continue
;;
*) return 0 ;;
esac
done
}
# Print an error message
error() {
echo "\nError: $*" >&2
return 1
}
# Start of actual command.
# First change to the correct directory in which the text files are located in.
cd /usr/doc/newinfo
clear
# Initial message to be displayed on startup of newinfo.
echo "Welcome to the %% Enter the name of the menu here.%% "
echo " "
# These 3 lines are required by the licencse agreement. This is all I request
# not to be modified.
echo "Created under NewInfo Version 1.1."
echo "(C) Matt E. Bottrell, 1995. All Rights Reserved."
echo "Email meb@deakin.edu.au for details."
echo " " ; echo " " ; echo " "
echo -n "Loading. Please wait."
sleep 1
echo -n "." # Not the nicest way, but needed for portability.
sleep 1
echo -n "."
sleep 1
echo -n "."
sleep 1
echo -n "."
# Display the menu system.
clear
mesg="$so$TIME Madhouse Information System $DATE $me
$md$MACHINE$me
-------------------------------------------------------------------------------
$md SYSTEM NEWS.$me
$so 1.$me January. $so 2.$me February. $so 3.$me March.
$so 4.$me April. $so 5.$me May. $so 6.$me June.
$so 7.$me July. $so 8.$me August. $so 9.$me September.
$so 10.$me October. $so 11.$me November. $so 12.$me December.
$md GENERAL NEWS.$me
$so 50.$me General Info. $so 51.$me Of Interest. $so 52.$me Email Info.
$so 53.$me Today's Message.$so 54.$me IRC Tutorial.
$md EMAIL SUPPORT.$me
$so 60.$me Email Author. $so 61.$me Email Help Desk. $so 62.$me Email Root.
-------------------------------------------------------------------------------
Select an option and press ENTER (or q to quit):$so $me"
while :
do prompt || bye_bye
case $cmd in
1) echo $me
btype="January News Articles. . . ."
FILEREAD="jan"
read_news
;;
2) echo $me
btype="February News Articles. . . ."
FILEREAD="feb"
read_news
;;
3) echo $me
btype="March News Articles. . . ."
FILEREAD="mar"
read_news
;;
4) echo $me
btype="April News Articles. . . ."
FILEREAD="apr"
read_news
;;
5) echo $me
btype="May News Articles. . . ."
FILEREAD="may"
read_news
;;
50) echo $me
btype="General Madhouse News. . . ."
FILEREAD="general"
read_news
;;
51) echo $me
btype="Things Of Interest. . . ."
FILEREAD="interest"
read_news
;;
52) echo $me
btype="Email Support Information. . . ."
FILEREAD="email"
read_news
;;
53) echo $me
btype="Message of the day. . . ."
FILEREAD="/etc/motd"
read_news
;;
54) echo $me
btype="Background of Madhouse IRC. . . ."
FILEREAD="irc"
read_news
;;
60) echo $me
clear
echo "Email the Author of New-Info. . . ."
sleep 3
pine meb@deakin.edu.au
;;
61) echo $me
clear
echo "Email the Help Desk. . . ."
sleep 3
pine problems
;;
62) echo $me
clear
echo "Email the Operator. . . ."
sleep 3
pine root
;;
*) echo $me
echo "Enter either 1 - 5, 50 - 54, 60 - 62 or q to quit"
sleep 5
;;
esac
done
bye_bye